package com.s1nx.back.dao;

import com.s1nx.back.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserDao {


    @Select("SELECT * FROM fb_user WHERE username = #{username} AND password = #{password}")
    User login(User user);

    //根据用户名和密码查询用户
    @Select("SELECT * FROM fb_user WHERE username = #{username} AND password = #{password}")
    User getUserByUsernameAndPassword(User user);

    //根据用户名查询用户
    @Select("SELECT * FROM fb_user WHERE username = #{username}")
    User getUserByUsername(User user);

    //注册用户
    @Insert("INSERT INTO " +
            "fb_user(username, password, create_time, update_time) " +
            "VALUES" +
            "(#{username}, #{password}, #{createTime}, #{updateTime})")
    int insertUser(User user);


}
